<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" class="h-100">
<head>
	<meta charset="utf-8">
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<title>All Employees</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css"/>
	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.slim.min.js"></script>
	<script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
	<style>
		main > .container {
			padding: 60px 15px 0;
		}
		.footer {
			background-color: #f5f5f5;
		}
	</style>
</head>
<body class="d-flex flex-column h-100">
	<header>
		<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
			<a class="navbar-brand" th:href="@{/}">Spring Boot 2</a>
			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
				<span class="navbar-toggler-icon"></span>
			</button>
			<div class="collapse navbar-collapse" id="navbarsExampleDefault">
				<ul class="navbar-nav mr-auto">
					<li class="nav-item active">
						<a class="nav-link" th:href="@{/}">Home <span class="sr-only">(current)</span></a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="https://github.com/T5750/framework-repositories" target="_blank">GitHub</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="https://t5750.github.io/" target="_blank">Blog</a>
					</li>
				</ul>
			</div>
		</nav>
	</header>
	<main role="main" class="flex-shrink-0">
		<div class="container my-2">
			<div class="card">
				<div class="card-body">
					<div th:switch="${employees}" class="container my-3">
						<p class="my-3">
							<a href="/employeePage/edit" class="btn btn-primary">
								<i class="fas fa-user-plus ml-2"> Add Employee </i></a>
						</p>
						<div class="col-md-10">
							<h2 th:case="null">No record found !!</h2>
							<div th:case="*">
								<table class="table table-striped table-responsive-md">
									<thead>
									<tr>
										<th>First Name</th>
										<th>Last Name</th>
										<th>Email</th>
										<th>Edit</th>
										<th>Delete</th>
									</tr>
									</thead>
									<tbody>
									<tr th:each="employee : ${employees}">
										<td th:text="${employee.firstName}"></td>
										<td th:text="${employee.lastName}"></td>
										<td th:text="${employee.email}"></td>
										<td>
											<a th:href="@{/employeePage/edit/{id}(id=${employee.id})}" class="btn btn-primary">
												<i class="fas fa-user-edit ml-2"></i>
											</a>
										</td>
										<td>
											<a th:href="@{/employeePage/delete/{id}(id=${employee.id})}" class="btn btn-primary">
												<i class="fas fa-user-times ml-2"></i>
											</a>
										</td>
									</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</main>
	<footer class="footer mt-auto py-3">
		<div class="container">
			<span class="text-muted">© 2019 T5750</span>
		</div>
	</footer>
</body>
</html>